﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once

#include "GcmpDbCommonEdit.h"
#include "ElementId.h"

namespace gcmp
{
    class IDocument;
    class IPlane;
    class IGraphicsNodeReference;
    class ICurve3d;
    class ICurve;
    class IElement;
    class IPolyCurve;
    class IGraphicsCurve3d;
    class IGraphicsNode;
    class Vector3d;
    class Coordinate3d;

    /// \brief 修角/修剪或延伸操作的工具类
    class GCMP_DB_COMMON_EDIT_EXPORT TrimUtils final
    { 
    public:
        /// \brief 修剪或延伸图形到另一个图形定义的边界,
        ///        将被修剪或延伸对象对应的文档元素修改为修剪或延伸后的结果
        ///
        /// 边界支持的类型有:Fam2DSketchCurve,ModelLine,ReferencePlane,ReferenceLine,GraphicsBRepFace,以及定制了IElementTrimCurveStrategy的文档元素
        /// 修剪或延伸对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当操作对象无法直接进行修剪或延伸计算时，将边界和操作对象投影至该平面进行修剪或延伸计算
        /// \param opGraphicsNodeBoundary [in] 修剪或延伸边界的图形节点
        /// \param opGraphicsNodeReferenceTarget [in] 被修剪或延伸对象的图形节点引用
        /// \param boundaryElementId [in] 边界的ElementId
        /// \param pickedPoint1 [in] 边界的拾取点
        /// \return 操作成功则返回true，否则返回false
        static bool TrimOrExtend(
            gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNode> opGraphicsNodeBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::ElementId boundaryElementId,
            const gcmp::Vector3d& pickedPoint1);

        /// \brief 修剪或延伸图形到另一个不同文档图形定义的边界,
        ///        将被修剪或延伸对象对应的文档元素修改为修剪或延伸后的结果
        ///
        /// 边界支持的类型有:Fam2DSketchCurve,ModelLine,ReferencePlane,ReferenceLine,GraphicsBRepFace,以及定制了IElementTrimCurveStrategy的文档元素
        /// 修剪或延伸对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 边界图形所属的文档
        /// \param pDocument [in] 被修剪或延伸对象的图形图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当操作对象无法直接进行修剪或延伸计算时，将边界和操作对象投影至该平面进行修剪或延伸计算
        /// \param opGraphicsNodeBoundary [in] 修剪或延伸边界的图形节点
        /// \param opGraphicsNodeReferenceTarget [in] 被修剪或延伸对象的图形节点引用
        /// \param boundaryElementId [in] 边界的ElementId
        /// \param pickedPoint1 [in] 边界的拾取点
        /// \return 操作成功则返回true，否则返回false
        static bool TrimOrExtend(
            gcmp::IDocument* pDocumentBoundary,
            gcmp::IDocument* pDocumentTarget,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNode> opGraphicsNodeBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::ElementId boundaryElementId,
            const gcmp::Vector3d& pickedPoint1);

        /// \brief 根据图形是否直接相交或者延伸相交,判断图形可否进行修剪或延伸操作
        ///
        /// 边界支持的类型有:Fam2DSketchCurve,ModelLine,ReferencePlane,ReferenceLine,GraphicsBRepFace,以及定制了IElementTrimCurveStrategy的文档元素
        /// 修剪或延伸对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素              
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当操作对象无法直接进行修剪或延伸计算时，将边界和操作对象投影至该平面进行修剪或延伸计算
        /// \param opGraphicsNodeReferenceBoundary [in] 修剪或延伸边界的图形节点
        /// \param opGraphicsNodeReferenceTarget [in] 修剪或延伸对象的图形节点
        /// \return 可以则返回true，否则返回false
        static bool CanBeTrimOrExtend(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNode> opGraphicsNodeBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            const gcmp::Vector3d& pickedPoint1
        );

        /// \brief 根据所提供的修剪或延伸的边界的图形节点的引用,
        ///        以及修剪或延伸的对象的图形节点的引用,
        ///        计算修剪或延伸操作的结果三维曲线
        ///
        /// 边界支持的类型有:Fam2DSketchCurve,ModelLine,ReferencePlane,ReferenceLine,GraphicsBRepFace,以及定制了IElementTrimCurveStrategy的文档元素
        /// 修剪或延伸对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当操作对象无法直接进行修剪或延伸计算时，将边界和操作对象投影至该平面进行修剪或延伸计算
        /// \param opGraphicsNodeReferenceBoundary [in] 修剪或延伸边界的图形节点的引用
        /// \param opGraphicsNodeReferenceTarget [in] 修剪或延伸对象的图形节点的引用
        /// \param opCurveResult [out] 修剪或延伸对象对应的结果三维曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimOrExtendResultCurve(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNode> opGraphicsNodeBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

        /// \brief 计算延伸操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param opReferenceBoundary [in] 延伸操作对象对应的参考边界曲线
        /// \param pBaseCurve [in] 指针，指向延伸操作对象的基准曲线
        /// \param pickedPoint [in] 延伸操作对象上的拾取点
        /// \param opCurveResult [out] 延伸后的曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateExtendResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::OwnerPtr<gcmp::ICurve3d> opReferenceBoundary,
            const gcmp::ICurve3d* pBaseCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

        /// \brief 计算Curve3d作为边界延伸多段线操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param opReferenceBoundary [in] 延伸操作对象对应的参考Curve3d边界曲线
        /// \param pPolyCurve [in] 指针，指向延伸操作对象的基准多段线曲线
        /// \param pickedPoint [in] 延伸操作对象上的拾取点
        /// \param opCurveResult [out] 延伸后的多段线曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculatePolyCurveExtendResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::OwnerPtr<gcmp::ICurve3d> opReferenceBoundary,
            const gcmp::IPolyCurve* pPolyCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::IPolyCurve>& opCurveResult);

        /// \brief 计算多段线作为边界延伸多段线操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param opReferenceBoundary [in] 延伸操作对象对应的参考边界多段线曲线
        /// \param pPolyCurve [in] 指针，指向延伸操作对象的基准多段线曲线
        /// \param pickedPoint [in] 延伸操作对象上的拾取点
        /// \param opCurveResult [out] 延伸后的多段线曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculatePolyCurveExtendResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::OwnerPtr<gcmp::IPolyCurve> opPolyCurveBoundary,
            const gcmp::IPolyCurve* pPolyCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::IPolyCurve>& opCurveResult);

        /// \brief 计算多段线作为边界延伸Curve3d操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param opPolyCurveBoundary [in] 延伸操作对象对应的参考边界多段线曲线
        /// \param pBaseCurve [in] 指针，指向延伸操作对象的基准Curve3d曲线
        /// \param pickedPoint [in] 延伸操作对象上的拾取点
        /// \param opCurveResult [out] 延伸后的Curve3d曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateCurve3dExtendByPolyCurveResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::OwnerPtr<gcmp::IPolyCurve> opPolyCurveBoundary,
            const gcmp::ICurve3d* pBaseCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

        /// \brief 计算多段线自延伸操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param pPolyCurve [in] 延伸操作对象对应的多段线曲线
        /// \param pickedPoint [in] 延伸操作对象上的拾取点
        /// \param opCurveResult [out] 延伸后的多段线曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculatePolyCurveSelfExtendResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::IPolyCurve* pPolyCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::IPolyCurve>& opCurveResult);

        /// \brief 计算修剪操作的结果曲线
        ///
        /// \param pDocument [in] 当前文档
        /// \param opProjectPlane [in] 投影平面
        /// \param opReferenceBoundary [in] 修剪操作对象对应的参考边界曲线
        /// \param pBaseCurve [in] 指针，指向修剪操作对象的基准曲线
        /// \param pickedPoint [in] 修剪操作对象上的拾取点
        /// \param opCurveResult [out] 修剪操作的结果曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimedResultCurve(
            const gcmp::IDocument* pDocument,
            const gcmp::OwnerPtr<gcmp::IPlane> opProjectPlane,
            const gcmp::OwnerPtr<gcmp::ICurve3d> opReferenceBoundary,
            const gcmp::ICurve3d* pBaseCurve,
            const gcmp::Vector3d& pickedPoint,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

        /// \brief 计算以多个Curve3d为边界修剪多段线操作的结果曲线
        ///
        /// \param coordinate [in] 多段线所在坐标系
        /// \param vecReferenceBoundary [in] 修剪操作对象对应的参考边界集
        /// \param pPolyCurve [in] 指针，指向修剪操作对象的多段线曲线
        /// \param pickedPoint [in] 修剪操作对象上的拾取点
        /// \param opCurvesResult [out] 修剪操作的结果曲线集合
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimPolyCurveByCurve3ds(
            const Coordinate3d& coordinate,
            const std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>& vecReferenceBoundary,
            const gcmp::IPolyCurve* pPolyCurveToTrim,
            const gcmp::Vector3d& pickedPoint,
            std::vector<gcmp::OwnerPtr<gcmp::IPolyCurve>>& opCurvesResult);

        /// \brief 计算以多个Curve3d为边界修剪多段线操作的结果曲线
        ///
        /// \param coordinate [in] 多段线所在坐标系
        /// \param vecReferenceBoundary [in] 修剪操作对象对应的参考边界集
        /// \param pPolyCurve [in] 指针，指向修剪操作对象的多段线曲线
        /// \param pickedPoint [in] 修剪操作对象上的拾取点
        /// \param opCurvesResult [out] 修剪操作的结果曲线集合
        /// \param trimPointsInfos[out] 修剪点以及对应曲线索引信息
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimPolyCurveByCurve3dsWithTrimPointsInfo(
            const Coordinate3d& coordinate,
            const std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>& vecReferenceBoundary,
            const gcmp::IPolyCurve* pPolyCurveToTrim,
            const gcmp::Vector3d& pickedPoint,
            std::vector<gcmp::OwnerPtr<gcmp::IPolyCurve>>& opCurvesResult,
            std::vector<std::pair<int, gcmp::Vector3d>>& trimPointsInfos);

        /// \brief 计算以多个Curve3d为边界修剪Curve3d操作的结果曲线
        ///
        /// \param coordinate [in] 待修剪Curve3d所在坐标系
        /// \param vecReferenceBoundary [in] 修剪操作对象对应的参考边界集
        /// \param pCurve3dToTrim [in] 指针，指向修剪操作对象Curve3d曲线
        /// \param pickedPoint [in] 修剪操作对象上的拾取点
        /// \param opCurvesResult [out] 修剪操作的结果曲线集合
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimCurve3dByCurve3ds(
            const Coordinate3d& coordinate,
            const std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>& vecReferenceBoundary,
            const gcmp::ICurve3d* pCurve3dToTrim,
            const gcmp::Vector3d& pickedPoint,
            std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>& opCurvesResult);

        /// \brief 根据所提供的修剪或延伸的边界的三维曲线和对应的拾取点,
        ///        以及修剪或延伸的对象的三维曲线和对应的拾取点,
        ///        计算修剪或延伸操作的结果三维曲线
        ///
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当操作对象无法直接进行修剪或延伸计算时，将边界和操作对象投影至该平面进行修剪或延伸计算
        /// \param opCurveBoundary [in] 修剪或延伸边界的三维曲线
        /// \param opCurveTarget [in] 修剪或延伸对象的三维曲线
        /// \param PickPointBoundary [in] 修剪或延伸边界的拾取点
        /// \param PickPointTarget [in] 修剪或延伸对象的拾取点
        /// \param opCurveResult [out] 修剪或延伸对象对应的结果三维曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimOrExtendResultCurve(
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<gcmp::ICurve3d> opCurveBoundary,
            gcmp::OwnerPtr<gcmp::ICurve3d> opCurveTarget,
            gcmp::Vector3d PickPointBoundary,
            gcmp::Vector3d PickPointTarget,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

        static gcmp::OwnerPtr<gcmp::IGraphicsNode> calcNodeRefBoundary(const gcmp::IDocument* pDoc, OwnerPtr<gcmp::IPlane> opPlane, const gcmp::IGraphicsNodeReference& nodeReference);

    public:
        /// \brief 修剪或延伸两个图形,以形成一个角,
        ///        将图形对应的文档元素修改为修剪或延伸后的结果
        ///
        /// 修角对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当修角对象无法直接进行修角计算时，将修角对象投影至该平面进行修角计算 
        /// \param opGraphicsNodeReferenceTarget [in] 修角对象的图形节点的引用
        /// \param opGraphicsNodeReferenceAnotherTarget [in] 修角对象的图形节点的引用
        /// \return 操作成功则返回true，否则返回false
        static bool TrimOrExtendToCorner(
            gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceAnotherTarget);

        /// \brief 根据图形是否直接相交或者延伸相交,判断图形可否进行修角操作
        ///
        /// 修角对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当修角对象无法直接进行修角计算时，将修角对象投影至该平面进行修角计算 
        /// \param opGraphicsNodeReferenceTarget [in] 修角对象的图形节点的引用
        /// \param opGraphicsNodeReferenceAnotherTarget [in] 修角对象的图形节点的引用
        /// \return 可以则返回true，否则返回false
        static bool CanBeTrimOrExtendToCorner(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceAnotherTarget);

        /// \brief 根据所提供的修角对象的图形节点的引用,
        ///        计算修角操作的结果三维曲线
        ///
        /// 修角对象支持的类型有:Fam2DSketchCurve,ModelLine,Instance,ReferenceLine,以及定制了IElementTrimCurveStrategy的文档元素
        /// \param pDocument [in] 图形所属的文档
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当修角对象无法直接进行修角计算时，将修角对象投影至该平面进行修角计算 
        /// \param opGraphicsNodeReferenceTarget [in] 修角对象的图形节点的引用
        /// \param opGraphicsNodeReferenceAnotherTarget [in] 修角对象的图形节点的引用
        /// \param opCurveResult [out] 修角对象对应的结果三维曲线
        /// \param opCurveAnotherResult [out] 修角对象对应的结果三维曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimOrExtendToCornerResultCurves(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceAnotherTarget,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveAnotherResult);

        /// \brief 根据所提供的修角对象的三维曲线和对应的拾取点,
        ///        计算修角操作的结果三维曲线
        /// \param opProjectPlane [in] 投影平面
        ///
        /// 当修角对象无法直接进行修角计算时，将修角对象投影至该平面进行修角计算 
        /// \param opCurveTarget [in] 修角对象的三维曲线
        /// \param opCurveAnotherTarget [in] 修角对象的三维曲线
        /// \param PickPointTarget [in] 修角对象的拾取点
        /// \param PickPointAnotherTarget [in] 修角对象的拾取点
        /// \param opCurveResult [out] 修角对象对应的结果三维曲线
        /// \return 操作成功则返回true，否则返回false
        static bool CalculateTrimOrExtendToCornerResultCurves(
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<gcmp::ICurve3d> opCurveTarget,
            gcmp::OwnerPtr<gcmp::ICurve3d> opCurveAnotherTarget,
            gcmp::Vector3d PickPointTarget,
            gcmp::Vector3d PickPointAnotherTarget,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveAnotherResult);

    public:
        /// \brief 修改文档元素的三维曲线
        /// \param pElementTarget [in] 修角/修剪或延伸操作对象文档元素
        /// \param pTrimOrExtendResultGCurve [in] 修角/修剪或延伸操作对象对应的结果三维曲线
        /// \return 修改成功则返回true，否则返回false
        static bool ModifyElement(
            gcmp::IElement* pElementTarget,
            const gcmp::IGraphicsCurve3d* pTrimOrExtendResultGCurve);

        /// \brief 修复修剪或延伸操作后文档元素的共点约束
        /// \param pDocument [in] 图形所属的文档
        /// \param pElementBoundary [in] 修剪或延伸边界文档元素
        /// \param pElementTarget [in] 修剪或延伸对象文档元素
        /// \return 修复成功则返回true，否则返回false
        static bool RepairConstraintsAfterTrimOrExtend(
            gcmp::IDocument* pDocument,
            gcmp::IElement* pElementBoundary,
            gcmp::IElement* pElementTarget);

        /// \brief 修复修角操作后文档元素的共点约束
        /// \param pDocument [in] 图形所属的文档
        /// \param pElementTarget [in] 修角对象文档元素
        /// \param pElementAnotherTarget [in] 修角对象文档元素
        /// \return 修复成功则返回true，否则返回false
        static bool RepairConstraintsAfterTrimOrExtendToCorner(
            gcmp::IDocument* pDocument,
            gcmp::IElement* pElementTarget,
            gcmp::IElement* pElementAnotherTarget);
            
        static bool TrimOrExtend(
            gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget);

        static bool TrimOrExtend(
            gcmp::IDocument* pDocumentBoundary,
            gcmp::IDocument* pDocumentTarget,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget);

        static bool CanBeTrimOrExtend(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget);

        static bool CanBeTrimOrExtend(
            const gcmp::IDocument* pDocumentBoundary,
            const gcmp::IDocument* pDocumentTarget,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget);

         static bool CalculateTrimOrExtendResultCurve(
            const gcmp::IDocument* pDocument,
            OwnerPtr<gcmp::IPlane> opProjectPlane,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
            gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
            gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

         static bool CalculateTrimOrExtendResultCurve(
             const gcmp::IDocument* pDocumentBoundary,
             const gcmp::IDocument* pDocumentTarget,
             OwnerPtr<gcmp::IPlane> opProjectPlane,
             gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceBoundary,
             gcmp::OwnerPtr<IGraphicsNodeReference> opGraphicsNodeReferenceTarget,
             gcmp::OwnerPtr<gcmp::ICurve3d>& opCurveResult);

         /// \brief 计算多段线修剪操作的结果多段线曲线
         ///
         /// \param pDocument [in] 当前文档
         /// \param opProjectPlane [in] 投影平面
         /// \param opReferenceBoundary [in] 修剪操作对象对应的参考边界(Curve3d)
         /// \param pPolyCurve [in] 指针，指向修剪操作对象的多段线曲线
         /// \param pickedPoint [in] 修剪操作对象上的拾取点
         /// \param opCurvesResult [out] 修剪操作的结果曲线集合
         /// \return 操作成功则返回true，否则返回false
         GCMP_OBSOLETE_API(2022 / 09 / 01, TrimUtils::CalculateTrimPolyCurveByCurve3ds(const Coordinate3d&, const std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>&,
             const gcmp::IPolyCurve*,const gcmp::Vector3d&,std::vector<gcmp::OwnerPtr<gcmp::IPolyCurve>>&))
             static bool CalculatePolyCurveTrimedResultCurve(const gcmp::IDocument*, const gcmp::OwnerPtr<gcmp::IPlane>,
                 const gcmp::OwnerPtr<gcmp::ICurve3d>, gcmp::IPolyCurve*, const gcmp::Vector3d&, std::vector<gcmp::OwnerPtr<gcmp::IPolyCurve>>&);

         /// \brief 计算多段线为边界修剪Curve3d操作的结果曲线
         ///
         /// \param pDocument [in] 当前文档
         /// \param opProjectPlane [in] 投影平面
         /// \param opPolyCurveBoundary [in] 修剪操作对象对应的参考边界(PolyCurve)
         /// \param opCurve3dToTrim [in] 指针，指向修剪操作对象Curve3d曲线
         /// \param pickedPoint [in] 修剪操作对象上的拾取点
         /// \param opCurvesResult [out] 修剪操作的结果曲线集合
         /// \return 操作成功则返回true，否则返回false
         GCMP_OBSOLETE_API(2022 / 09 / 01, TrimUtils::CalculateTrimCurve3dByCurve3ds(const Coordinate3d& ,const std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>&,
             const gcmp::ICurve3d*,const gcmp::Vector3d&,std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>&))
             static bool CalculateTrimCurve3dByPolyCurve(const gcmp::IDocument*, const gcmp::OwnerPtr<gcmp::IPlane>,
                 const gcmp::OwnerPtr<gcmp::IPolyCurve>,gcmp::ICurve3d*, const gcmp::Vector3d&, std::vector<gcmp::OwnerPtr<gcmp::ICurve3d>>&);
    };
}

